/*
 * Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
 *
 * Licensed under the Mulan PSL v2.
 * You can use this file according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of the License at
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
 * FOR MORE DETAILS.
 */

/*
 * @Author: Wang Shuo wangshuo@sgsimulation.com
 * @Date: 2024-07-08 10:50:03
 * @LastEditors: 武兴创 superjava@vip.qq.com
 * @LastEditTime: 2024-08-28 22:41:23
 * @FilePath: \SGFEM\DBManager\Service\Constraint\SPCService.h"
 */
#pragma once
#include "DBManager/Common/ServiceMacro.h"
#include "DBManager/IRepository/Input/Constraint/ISPCADDRepository.h"
#include "DBManager/IRepository/Input/Constraint/ISPCRepository.h"
#include "DBManager/IService/Input/Constraint/ISPCService.h"

SG_DBMANAGER_NAMESPACE_OPEN
using IRepos = ISPCRepository;
class DBManager_DECLSPEC SPCService : ISPCService
{
  public:
    SPCService (ISPCRepository& repos, ISPCADDRepository& spcaddRepos);
    ~SPCService () = default;

    // 添加单点约束
    FUNCTION_Add (ServiceDataType);

    // 返回单点约束的数量
    std::size_t Size () override;

    // 根据索引查找单点约束
    SG::DataStructure::Common::Status FindByIndex (std::size_t index, SG::DataStructure::FEM::SPCData& _OUT entity) override;

    /** @brief 查询sid约束集编号对应的所有spc */
    SG::DataStructure::Common::Status FindBySId (SG::DataStructure::Common::Id                      sId,
                                                 std::vector<SG::DataStructure::FEM::SPCData>& _OUT mpcSet) override;

  private:
    ISPCRepository&    m_repository;        ///< 数据仓库
    ISPCADDRepository& m_spcaddRepository;  ///< 数据仓库
};

SG_DBMANAGER_NAMESPACE_CLOSE
